import 'package:components/html_extensions/img.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:common/export/tools.dart';

class LaraPressHtml extends StatelessWidget {
  final String html;
  const LaraPressHtml({super.key, required this.html});

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        final maxWidth = constraints.maxWidth;
        return Html(
          data: html,
          extensions: [LaraPressImgExtension()],
          style: {
            '*': Style(
              lineHeight: LineHeight(2),
              fontSize: FontSize(14.sp),
              margin: Margins.symmetric(vertical: 4.h),
            ),
            'h2': Style(fontSize: FontSize(18.sp), fontWeight: FontWeight.bold),
            'h3': Style(fontSize: FontSize(16.sp), fontWeight: FontWeight.bold),
            'h4': Style(fontSize: FontSize(14.sp), fontWeight: FontWeight.bold),
            'h5': Style(fontSize: FontSize(14.sp), fontWeight: FontWeight.bold),
            'h6': Style(fontSize: FontSize(14.sp), fontWeight: FontWeight.bold),
          },
        );
      },
    );
  }
}
